@echo off
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
setlocal enabledelayedexpansion
echo.
ver | find "10." > NUL && goto win10
 
:error
mshta vbscript:msgbox(" 操作系统不是Windows10，此脚本不适用。",vbSystemModal+64,"不要开玩笑!")(window.close) 
exit
 
:win10
 
::改写组策略
echo Windows Registry Editor Version 5.00 >%temp%\smb.reg
echo. >> %temp%\smb.reg
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\LanmanWorkstation] >> %temp%\smb.reg
echo @=""  >> %temp%\smb.reg
echo "AllowInsecureGuestAuth"=dword:00000001 >> %temp%\smb.reg
regedit /s %temp%\smb.reg
 
echo 添加smb访问组件
dism /online /format:table /get-features
dism /online /enable-feature /featurename:SMB1Protocol
 
mshta vbscript:msgbox(" 设置完成。电脑重启后生效！",vbSystemModal+64,"注意！！！")(window.close) 
 
exit